{}
Now that we get objects, Lets see how we can type less as we create them.
Video Transcript
00:01The last thing I want to talk about that's directly connected to the object of object type is
00:08Because object is so so common and it's one of the most basic fundamental
00:13Ways of building flash application. I just want to quickly just show how we built our object so far
00:18So right so we said new and then we said object open and close the bracket. That's an old-school way
00:24Well, not really old school
00:25That is the the you know, the full quoted way of building it in flash
00:29But flash knew that it's such a basic basic type that it created a really quick very easy shortcut to create objects
00:36That shortcut is Oh
00:39Object, right? We we always define our object the way we defined it before we're setting our object type to help our compiler
00:46Figure out different errors related to object types. Then we're gonna open a curly bracket close up curly bracket done
00:53We've just created a new object and these curly brackets are basically the same thing as if we would type new object
01:00Now the power of using these curly brackets not only that it's short right here. It also enables us
01:05Let's see if we would want if we wanted to create our just comment that out
01:11If we create a new object and let's give our object actually real properties and let's talk for a second
01:16What what would we put an object so far? We just put random things into our objects
01:21And as we said before our objects usually always are buckets of information and that bucket
01:27Usually the way we like to put things in our buckets is put things that are kind of connected together and for example
01:34Let's say their object is a person. Okay, so instead of making a new Oh, let's create a new well not present
01:41Let's say let's create a new cat
01:43Okay, and our cat is a type of object. So our cat has a name and
01:48our cat's name is
01:50Jerry and
01:52Our cat has an age and Jerry's age is four and our cat has a color and our cat's color is
02:05blue
02:09Blue I don't know why I'm using our okay, so we just set a few properties to our cat which is
02:16Brilliant, you know, we definitely could do it this way
02:19We could definitely do it also this way, right? So I'm gonna create a
02:22Second cat let's call this. Let's let's create a dog this time around
02:26Not a cod a dog. So creating a dog. We're gonna give our dog a name and
02:32we're gonna give our dog a name of
02:36Bone and
02:38We're gonna give our dog an age and our dog's age would be eight
02:43and we could give our dog a color as well and
02:48the dog's color is pink
02:52So we've seen what another way now, let's see how we could do is even shorter even quicker
02:57The easiest and most quickest way of creating a variable
03:01An object is let's see this. So we created cab create a dog. Let's create now a bird
03:07Okay, done. So we're creating a new bird now. Look at this. Look how cool these
03:12Curly brackets are so first of all, I'm just gonna open and close a curly bracket just to make sure that I've got everything
03:17There the way I need to get it
03:20Now we could actually put all the different properties of our object directly into our definition because we already know let me just
03:27Make the screen bigger again, so we could see everything at the same time
03:31So let me let's do this. So first of all, I'm gonna type name and then I'm gonna put a colon and
03:37Then I'm gonna call this bird. Um
03:41Daffy
03:42We call it death and then I'm gonna put your a comma and I'm gonna say its age is
03:49two and a comma again color is
03:54black and I just created now dynamically three properties really really quickly in one line
04:03I actually created what I could have done in two three four lines, which is really cool
04:09Less legible, but completely cool. Now one thing you could do if you wanted to you could always break a line
04:15Flash doesn't care as long as you have your open and closed bracket curly brackets
04:18Remember those curly brackets they enables us enable us to you know, make it a little bit more legible and here we go
04:24Now it's legible, but it's three lines
04:26But still it's legible which is always good because then it makes it easier for us to read and you could always put extra spaces
04:33There's no problem with extra spaces
04:35It's all all good
04:38Only thing to read that is really important to note is one
04:41You put your property name
04:44Colon the value and then a comma and over and over until your last one where you don't put a comma anymore
04:51And that's how you're adding dynamically
04:54Creating your associative array or creating your object
